package com.cn.hnust.controller;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.cn.hnust.pojo.User;
import com.cn.hnust.service.IUserService;

@Controller
@RequestMapping("/test") 
public class TestController { 
    @Resource  
    private IUserService userService;  
      
    @RequestMapping("/index")  
    public String toIndex(HttpServletRequest request,Model model){  
        int userId = 1;  
        User user = this.userService.getUserById(userId);  
        model.addAttribute("user", user);  
        return "test";  
    }
    
    @RequestMapping("/test")  
    public String toTest(HttpServletRequest request,Model model){  
        int userId = 1;  
        User user = this.userService.getUserById(userId);  
        model.addAttribute("user", user);  
        return "test/test";  
    }
    
}
